package com.example.javafx.simple;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

public class TabPaneExample extends Application {

    @Override
    public void start(Stage primaryStage) {
        // 创建 TabPane
        TabPane tabPane = new TabPane();

        // 创建 Tab 标签页
        Tab tab1 = new Tab("Tab 1");
        tab1.setContent(new VBox(new javafx.scene.control.Label("Content of Tab 1")));
        
        Tab tab2 = new Tab("Tab 2");
        tab2.setContent(new VBox(new javafx.scene.control.Label("Content of Tab 2")));
        
        Tab tab3 = new Tab("Tab 3");
        tab3.setContent(new VBox(new javafx.scene.control.Label("Content of Tab 3")));

        // 将 Tab 添加到 TabPane
        tabPane.getTabs().addAll(tab1, tab2, tab3);

        // 设置 TabPane
        Scene scene = new Scene(tabPane, 400, 300);
        primaryStage.setTitle("TabPane Example");
        primaryStage.setScene(scene);
        primaryStage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}